package com.zhuozhou.jdyc.base;

import java.io.IOException;

/**
 * Create by CherishTang on 2019/8/1
 * describe:自定义异常封装
 */

public class BaseException extends IOException {
    private static final long serialVersionUID = 602780230218501625L;

    /**
     * 解析数据失败
     */
    static final String PARSE_ERROR = "1001";
    public static final String PARSE_ERROR_MSG = "解析数据失败";

    /**
     * 网络问题
     */
    static final String BAD_NETWORK = "1002";
    static final String BAD_NETWORK_MSG = "服务器或网络异常";
    /**
     * 连接错误
     */
    static final String CONNECT_ERROR = "1003";
    static final String CONNECT_ERROR_MSG = "连接错误";
    /**
     * 连接超时
     */
    static final String CONNECT_TIMEOUT = "1004";
    static final String CONNECT_TIMEOUT_MSG = "连接超时";
    /**
     * 未知错误
     */
    static final String OTHER = "1005";
    static final String OTHER_MSG = "未知错误";

    /**
     * 其他问题，即服务器返回的请求失败
     */
    public static final String REQUEST_ERROR = "1006";

    /**
     * 登录超时
     */
    public static final String TOKEN_ERROR = "1007";
    public static final String TOKEN_ERROR_MSG = "登录超时";


    private String errorMsg;
    private String errorCode;

    public String getErrorMsg() {
        return errorMsg;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public BaseException(String errorMsg, Throwable cause) {
        super(errorMsg, cause);
        this.errorMsg = errorMsg;
    }


    BaseException(String message, Throwable cause, String errorCode) {
        super(message, cause);
        this.errorCode = errorCode;
        this.errorMsg = message;
    }

    BaseException(String message, String errorCode) {
        this.errorCode = errorCode;
        this.errorMsg = message;
    }

}
